<?php ob_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> 飛羽主題攝影 </title>
<link href="css/photo.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/btn.css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cycle.js"></script>
<script type="text/javascript" src="js/slideshow.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		$(".hoverNews , .hoverWorking , .hoverGown , .hoverCos , .hoverLogo , .hoverLogo2 , .hoverAbout , .hoverInfor, .hoverOnline , .hoverContact , .hoverlist-topa , .hoverlist-topb").css("opacity","0");
		$(".hoverNews , .hoverWorking , .hoverGown , .hoverCos , .hoverLogo , .hoverLogo2 , .hoverAbout , .hoverInfor, .hoverOnline , .hoverContact , .hoverlist-topa , .hoverlist-topb").hover(function () {
			$(this).stop().animate({
				opacity: 1
			}, "fast");
		},
		function () {
			$(this).stop().animate({
				opacity: 0
			}, "fast");
		});
		});
	</script>
</head>
<body >
<div id="wrap"><!-- start #wrap //-->
<div id="main" class="clearfix"><!-- start #main //-->
<!-- start #top //-->
<?php 
    include_once('top.php');
    include_once('conn.php');
    include_once('util.php');

    $pageSize = 9;
    $nid = 2;
    if (!isset($_REQUEST['page'])) { 
        $_REQUEST['page'] = 1; 
    }

    if ($_REQUEST['page'] == 1) {
      $sql = sprintf("SELECT * FROM product WHERE nid = %d LIMIT %d", $nid, $pageSize);
    }else{
      $sql = sprintf("SELECT * FROM product WHERE nid = %d LIMIT %d, %d", $nid, $pageSize, $_REQUEST['page'] - 1);
    }
    $result = mysql_query($sql);
    $grow = mysql_fetch_assoc($result) ;
    $url = sprintf('%s?nid=%d&bigClassName=%s&title=%s', 'cos-working2.php', $nid, urlencode($grow['BigClassName']), urlencode($grow['title']));
    header("location: $url");
    ob_end_flush();
    die();
    //Util::jsAlert(false, $url);
?>
<!-- end #top //-->
<div id="all">

  <div class="photo-tit">
    <p>SHOW ROOM
    </p>
    <p>客戶作品</p>
  </div>
  
  <?php
  // --------- below will be depressed
  while( $row = mysql_fetch_assoc($result)) {
  ?>
     <div class="list-tab2">
<div class="list-p2">
		 <img src="<?php echo $row['images'];?>" width="289" height="193"  />
         <p ><?php echo $row['title']; ?><br />
         拍攝日期：<?php echo date('Y/m/d', strtotime($row['addtime'])); ?></p>
	</div>
     <a href="<?php printf("gown2.php?nid=%d&title=%s", $nid, $row['title']);?>">
<div class="list-topb"><div class="hoverlist-topb">
<p ><?php echo $row['title']; ?><br />
         拍攝日期：<?php echo date('Y/m/d', strtotime($row['addtime'])); ?></p>
</div></div></a>
  </div>
 <?php } 
 $sql = sprintf("SELECT count(*) as total FROM product WHERE nid = %d", $nid);
 $result = mysql_query($sql);
 $row = mysql_fetch_assoc($result);
 $pages = floor($row['total'] / $pageSize) + 1;
 ?> 
  <!-- div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-2.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>
  
  <div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-3.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>
  
  <div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-4.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>
  
  <div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-5.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>
  
  <div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-6.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>
  
  <div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-7.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>
  
  <div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-8.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>

<div class="list-tab2">
<div class="list-p2">
		 <img src="images/work-b-9.jpg" width="289" height="193"  />
         <p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
	</div>
     <a href="gown.php">
<div class="list-topb"><div class="hoverlist-topb">
<p > 世外桃源 Dragon<br />
         拍攝日期：2011/04/05</p>
</div></div></a>
  </div>

</div -->
<div id="photo-page">
  <ul>
    <?php 
    if ($_REQUEST['page'] < $pages) { 
        $next = $_REQUEST['page'] + 1;
    ?>
    <li>
        <a href="<?php printf('%s?page=%d', $_SERVER['PHP_SELF'], $next); ?>">
      NEXT
    </a></li>
    <?php } ?>
    <?php 
    if ($_REQUEST['page'] > 1) { 
        $prev = $_REQUEST['page'] - 1;
     ?>
    <li><a href="<?php printf('%s?page=%d', $_SERVER['PHP_SELF'], $prev);?>">
     PREV
    </a></li>
    <?php } ?>
  </ul>
</div>
</div><!-- end #main //-->
</div><!-- end #wrap //-->

<?php include_once('down.php');?>
</body>
</html>
